import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/common.less'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import log from 'electron-log';
import path from 'path';

const app = createApp(App);
app.use(ElementPlus);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.mount('#app');

// 日志配置
log.transports.file.resolvePath = (variables, message) => {
    let dir = variables.electronDefaultDir;
    if (!dir) {
        dir = variables.libraryDefaultDir;
    }
    let d = new Date();
    let compactTodayStr = d.getFullYear() + (d.getMonth() + 1).toString().padStart(2, '0') + d.getDate().toString().padStart(2, '0');
    // dir = path.resolve(dir, message.level, "renderer");
    return path.join(dir, `renderer_${compactTodayStr}.log`);
}
// 禁用日志文件占用大小限制
log.transports.file.maxSize = 0;
Object.assign(console, log.functions);